//
//  SDSettingTableViewCell.m
//  SKinDiary
//
//  Created by pcyang on 16/7/16.
//  Copyright © 2016年 tencent. All rights reserved.
//

#import "SDSettingTableViewCell.h"




@interface SDSettingTableViewCell ()

@property (nonatomic,strong)UIImageView *rightImageView;

@end

@implementation SDSettingTableViewCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self)
    {
        self.backgroundColor = [UIColor whiteColor];
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
        _topLineView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 1)];
        [_topLineView setBackgroundColor:[UIColor colorWithRGB:0xcad6e3]];
        [self.contentView addSubview:_topLineView];

        _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(kTagLeftPadding, 0, 50, 13)];
        _titleLabel.font = [UIFont systemFontOfSize:13];
        _titleLabel.textColor = [UIColor colorWithRGB:0xb4bec8];
        _titleLabel.textAlignment = NSTextAlignmentLeft;
        _titleLabel.text = @"";
        [self.contentView addSubview:_titleLabel];
        
        _subTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 50, 13)];
        _subTitleLabel.font = [UIFont systemFontOfSize:13];
        _subTitleLabel.textColor = [UIColor colorWithRGB:0x747f8b];
        [self.contentView addSubview:_subTitleLabel];
        
        _arrowLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 50, 13)];
        _arrowLabel.font = [UIFont systemFontOfSize:13];
        _arrowLabel.textColor = [UIColor colorWithRGB:0x747f8b];
        _arrowLabel.textAlignment = NSTextAlignmentRight;
        _arrowLabel.text = @"";
        [self.contentView addSubview:_arrowLabel];
        
         _bottomLineView = [[UIView alloc] initWithFrame:CGRectMake(0, kSettingTableViewCellHeight - 1, kScreenWidth, 1)];
        [_bottomLineView setBackgroundColor:[UIColor colorWithRGB:0xcad6e3]];
        [self.contentView addSubview:_bottomLineView];
        
        
    }
    return self;
}

-(void)setCellData:(NSString*)title
{
    _titleLabel.text = title;
   // _subTitleLabel.text = subtitle;
    [_titleLabel sizeToFit];
    [_subTitleLabel sizeToFit];
    [_arrowLabel sizeToFit];
    [self setNeedsLayout];
}

-(void)layoutSubviews
{
  //  _subTitleLabel.left = _titleLabel.right + 20;
    _arrowLabel.right = kScreenWidth - 20;
    _titleLabel.top = (self.height - _titleLabel.height)/2;
    _subTitleLabel.centerY = _titleLabel.centerY;
    _arrowLabel.centerY = _titleLabel.centerY;
}
@end
